/* -*-c++-*- */
/* osgEarth - Geospatial SDK for OpenSceneGraph
 * Copyright 2020 Pelican Mapping
 * http://osgearth.org
 *
 * osgEarth is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

#ifndef OSGEARTHSYMBOLOGY_CSSUTILS_H
#define OSGEARTHSYMBOLOGY_CSSUTILS_H 1

#include <osgEarth/Common>
#include <osgEarth/Config>
#include <vector>

namespace osgEarth { namespace Util
{
    using namespace osgEarth;

    class OSGEARTH_EXPORT CssUtils
    {
    public:
        static void readConfig( 
            const std::string& inputCSS,
            const std::string& referrer,
            ConfigSet&         output );

        /**
         * Takes a string containing CSS text, and splits it up into 
         * multiple strings, each one containing a single style definition
         * (still in CSS). A nameless block is named "default".
         *
         * Example INPUT:
         *
         *   s1 {
         *      fill: #ffff00;
         *   }
         *   s2 {
         *      stroke: #ffff00;
         *      altitude-mode: absoulte;
         *   }
         *   {
         *      marker: "something.flt";
         *   }
         *
         * Example OUTPUT:
         *
         *   [0] : s1 { fill: #ffff00; }
         *   [1] : s2 { stroke: #ffff00; altitude-mode: absolute; }
         *   [2] : default { marker: "something.flt"; }
         *
         */
        static void split( const std::string& css, std::vector<std::string>& output );
    };

} } // namespace osgEarth

#endif // OSGEARTHFEATURES_CSSUTILS_H
